home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / public / GNU / emacs.inst / emacs19.idb / usr / gnu / info / emacs-9.z / emacs-9
Encoding:
GNU Info File  |  1994-08-02  |  48.5 KB  |  1,155 lines

  1. This is Info file ../info/emacs, produced by Makeinfo-1.54 from the
  2. input file emacs.texi.
  3.  
  4. 
  5. File: emacs,  Node: Fill Prefix,  Prev: Fill Commands,  Up: Filling
  6.  
  7. The Fill Prefix
  8. ---------------
  9.  
  10.    To fill a paragraph in which each line starts with a special marker
  11. (which might be a few spaces, giving an indented paragraph), use the
  12. "fill prefix" feature.  The fill prefix is a string which Emacs expects
  13. every line to start with, and which is not included in filling.
  14.  
  15. `C-x .'
  16.      Set the fill prefix (`set-fill-prefix').
  17.  
  18. `M-q'
  19.      Fill a paragraph using current fill prefix (`fill-paragraph').
  20.  
  21. `M-x fill-individual-paragraphs'
  22.      Fill the region, considering each change of indentation as
  23.      starting a new paragraph.
  24.  
  25. `M-x fill-nonuniform-paragraphs'
  26.      Fill the region, considering only paragraph-separator lines as
  27.      starting a new paragraph.
  28.  
  29.    To specify a fill prefix, move to a line that starts with the desired
  30. prefix, put point at the end of the prefix, and give the command
  31. `C-x .' (`set-fill-prefix').  That's a period after the `C-x'.  To turn
  32. off the fill prefix, specify an empty prefix: type `C-x .' with point
  33. at the beginning of a line.
  34.  
  35.    When a fill prefix is in effect, the fill commands remove the fill
  36. prefix from each line before filling and insert it on each line after
  37. filling.  The fill prefix is also inserted on new lines made
  38. automatically by Auto Fill mode.  Lines that do not start with the fill
  39. prefix are considered to start paragraphs, both in `M-q' and the
  40. paragraph commands; this is just right if you are using paragraphs with
  41. hanging indentation (every line indented except the first one).  Lines
  42. which are blank or indented once the prefix is removed also separate or
  43. start paragraphs; this is what you want if you are writing
  44. multi-paragraph comments with a comment delimiter on each line.
  45.  
  46.    For example, if `fill-column' is 40 and you set the fill prefix to
  47. `;; ', then `M-q' in the following text
  48.  
  49.      ;; This is an
  50.      ;; example of a paragraph
  51.      ;; inside a Lisp-style comment.
  52.  
  53. produces this:
  54.  
  55.      ;; This is an example of a paragraph
  56.      ;; inside a Lisp-style comment.
  57.  
  58.    The `C-o' command inserts the fill prefix on new lines it creates,
  59. when you use it at the beginning of a line (*note Blank Lines::.).
  60. Conversely, the command `M-^' deletes the prefix (if it occurs) after
  61. the newline that it deletes (*note Indentation::.).
  62.  
  63.    You can use `M-x fill-individual-paragraphs' to set the fill prefix
  64. for each paragraph automatically.  This command divides the region into
  65. paragraphs, treating every change in the amount of indentation as the
  66. start of a new paragraph, and fills each of these paragraphs.  Thus,
  67. all the lines in one "paragraph" have the same amount of indentation.
  68. That indentation serves as the fill prefix for that paragraph.
  69.  
  70.    `M-x fill-nonuniform-paragraphs' is a similar command that divides
  71. the region into paragraphs in a different way.  It considers only
  72. paragraph-separating lines (as defined by `paragraph-separate') as
  73. starting a new paragraph.  Since this means that the lines of one
  74. paragraph may have different amounts of indentation, the fill prefix
  75. used is the smallest amount of indentation of any of the lines of the
  76. paragraph.
  77.  
  78.    The fill prefix is stored in the variable `fill-prefix'.  Its value
  79. is a string, or `nil' when there is no fill prefix.  This is a
  80. per-buffer variable; altering the variable affects only the current
  81. buffer, but there is a default value which you can change as well.
  82. *Note Locals::.
  83.  
  84. 
  85. File: emacs,  Node: Case,  Next: Text Mode,  Prev: Filling,  Up: Text
  86.  
  87. Case Conversion Commands
  88. ========================
  89.  
  90.    Emacs has commands for converting either a single word or any
  91. arbitrary range of text to upper case or to lower case.
  92.  
  93. `M-l'
  94.      Convert following word to lower case (`downcase-word').
  95.  
  96. `M-u'
  97.      Convert following word to upper case (`upcase-word').
  98.  
  99. `M-c'
  100.      Capitalize the following word (`capitalize-word').
  101.  
  102. `C-x C-l'
  103.      Convert region to lower case (`downcase-region').
  104.  
  105. `C-x C-u'
  106.      Convert region to upper case (`upcase-region').
  107.  
  108.    The word conversion commands are the most useful.  `M-l'
  109. (`downcase-word') converts the word after point to lower case, moving
  110. past it.  Thus, repeating `M-l' converts successive words.  `M-u'
  111. (`upcase-word') converts to all capitals instead, while `M-c'
  112. (`capitalize-word') puts the first letter of the word into upper case
  113. and the rest into lower case.  All these commands convert several words
  114. at once if given an argument.  They are especially convenient for
  115. converting a large amount of text from all upper case to mixed case,
  116. because you can move through the text using `M-l', `M-u' or `M-c' on
  117. each word as appropriate, occasionally using `M-f' instead to skip a
  118. word.
  119.  
  120.    When given a negative argument, the word case conversion commands
  121. apply to the appropriate number of words before point, but do not move
  122. point.  This is convenient when you have just typed a word in the wrong
  123. case: you can give the case conversion command and continue typing.
  124.  
  125.    If a word case conversion command is given in the middle of a word,
  126. it applies only to the part of the word which follows point.  This is
  127. just like what `M-d' (`kill-word') does.  With a negative argument,
  128. case conversion applies only to the part of the word before point.
  129.  
  130.    The other case conversion commands are `C-x C-u' (`upcase-region')
  131. and `C-x C-l' (`downcase-region'), which convert everything between
  132. point and mark to the specified case.  Point and mark do not move.
  133.  
  134.    The region case conversion commands `upcase-region' and
  135. `downcase-region' are normally disabled.  This means that they ask for
  136. confirmation if you try to use them.  When you confirm, you may enable
  137. the command, which means it will not ask for confirmation again.  *Note
  138. Disabling::.
  139.  
  140. 
  141. File: emacs,  Node: Text Mode,  Next: Outline Mode,  Prev: Case,  Up: Text
  142.  
  143. Text Mode
  144. =========
  145.  
  146.    When you edit files of text in a human language, it's more convenient
  147. to use Text mode rather than Fundamental mode.  Invoke `M-x text-mode'
  148. to enter Text mode.  In Text mode, TAB runs the function
  149. `tab-to-tab-stop', which allows you to use arbitrary tab stops set with
  150. `M-x edit-tab-stops' (*note Tab Stops::.).  Features concerned with
  151. comments in programs are turned off except when explicitly invoked.
  152. The syntax table is changed so that periods are not considered part of
  153. a word, while apostrophes, backspaces and underlines are.
  154.  
  155.    A similar variant mode is Indented Text mode, intended for editing
  156. text in which most lines are indented.  This mode defines TAB to run
  157. `indent-relative' (*note Indentation::.), and makes Auto Fill indent
  158. the lines it creates.  The result is that normally a line made by Auto
  159. Filling, or by LFD, is indented just like the previous line.  In
  160. Indented Text mode, only blank lines separate paragraphs--indented
  161. lines continue the current paragraph.  Use `M-x indented-text-mode' to
  162. select this mode.
  163.  
  164.    Text mode, and all the modes based on it, define `M-TAB' as the
  165. command `ispell-complete-word', which performs completion of the
  166. partial word in the buffer before point, using the spelling dictionary
  167. as the space of possible words.  *Note Spelling::.
  168.  
  169.    Entering Text mode or Indented Text mode runs the hook
  170. `text-mode-hook'.  Other major modes related to Text mode also run this
  171. hook, followed by hooks of their own; this includes Nroff mode, TeX
  172. mode, Outline mode and Mail mode.  Hook functions on `text-mode-hook'
  173. can look at the value of `major-mode' to see which of these modes is
  174. actually being entered.  *Note Hooks::.
  175.  
  176. * Menu:
  177.  
  178.   Emacs provides two other modes for editing text that is to be passed
  179. through a text formatter to produce fancy formatted printed output.
  180.  
  181. * Nroff Mode::  The major mode for editing input to the formatter nroff.
  182. * TeX Mode::    The major modes for editing input to the formatter TeX.
  183.  
  184.   Another mode is used for editing outlines.  It allows you to view the
  185. text at various levels of detail.  You can view either the outline
  186. headings alone or both headings and text; you can also hide some of the
  187. headings at lower levels from view to make the high level structure more
  188. visible.
  189.  
  190. * Outline Mode::The major mode for editing outlines.
  191.  
  192. 
  193. File: emacs,  Node: Outline Mode,  Next: TeX Mode,  Prev: Text Mode,  Up: Text
  194.  
  195. Outline Mode
  196. ============
  197.  
  198.    Outline mode is a major mode much like Text mode but intended for
  199. editing outlines.  It allows you to make parts of the text temporarily
  200. invisible so that you can see just the overall structure of the
  201. outline.  Type `M-x outline-mode' to switch to Outline mode as the
  202. major mode of the current buffer.  Type `M-x outline-minor-mode' to
  203. enable Outline mode as a minor mode in the current buffer.  When
  204. Outline minor mode is enabled, the `C-c' commands of Outline mode
  205. replace those of the major mode.
  206.  
  207.    When a line is invisible in outline mode, it does not appear on the
  208. screen.  The screen appears exactly as if the invisible line were
  209. deleted, except that an ellipsis (three periods in a row) appears at
  210. the end of the previous visible line (only one ellipsis no matter how
  211. many invisible lines follow).
  212.  
  213.    All editing commands treat the text of the invisible line as part of
  214. the previous visible line.  For example, `C-n' moves onto the next
  215. visible line.  Killing an entire visible line, including its
  216. terminating newline, really kills all the following invisible lines
  217. along with it; yanking it all back yanks the invisible lines and they
  218. remain invisible.
  219.  
  220.    Entering Outline mode runs the hook `text-mode-hook' followed by the
  221. hook `outline-mode-hook' (*note Hooks::.).
  222.  
  223. * Menu:
  224.  
  225. * Format: Outline Format.       What the text of an outline looks like.
  226. * Motion: Outline Motion.       Special commands for moving through
  227.                                      outlines.
  228. * Visibility: Outline Visibility.  Commands to control what is visible.
  229.  
  230. 
  231. File: emacs,  Node: Outline Format,  Next: Outline Motion,  Up: Outline Mode
  232.  
  233. Format of Outlines
  234. ------------------
  235.  
  236.    Outline mode assumes that the lines in the buffer are of two types:
  237. "heading lines" and "body lines".  A heading line represents a topic in
  238. the outline.  Heading lines start with one or more stars; the number of
  239. stars determines the depth of the heading in the outline structure.
  240. Thus, a heading line with one star is a major topic; all the heading
  241. lines with two stars between it and the next one-star heading are its
  242. subtopics; and so on.  Any line that is not a heading line is a body
  243. line.  Body lines belong with the preceding heading line.  Here is an
  244. example:
  245.  
  246.      * Food
  247.      
  248.      This is the body,
  249.      which says something about the topic of food.
  250.      
  251.      ** Delicious Food
  252.      
  253.      This is the body of the second-level header.
  254.      
  255.      ** Distasteful Food
  256.      
  257.      This could have
  258.      a body too, with
  259.      several lines.
  260.      
  261.      *** Dormitory Food
  262.      
  263.      * Shelter
  264.      
  265.      A second first-level topic with its header line.
  266.  
  267.    A heading line together with all following body lines is called
  268. collectively an "entry".  A heading line together with all following
  269. deeper heading lines and their body lines is called a "subtree".
  270.  
  271.    You can customize the criterion for distinguishing heading lines by
  272. setting the variable `outline-regexp'.  Any line whose beginning has a
  273. match for this regexp is considered a heading line.  Matches that start
  274. within a line (not at the beginning) do not count.  The length of the
  275. matching text determines the level of the heading; longer matches make
  276. a more deeply nested level.  Thus, for example, if a text formatter has
  277. commands `@chapter', `@section' and `@subsection' to divide the
  278. document into chapters and sections, you could make those lines count
  279. as heading lines by setting `outline-regexp' to
  280. `"@chap\\|@\\(sub\\)*section"'.  Note the trick: the two words
  281. `chapter' and `section' are equally long, but by defining the regexp to
  282. match only `chap' we ensure that the length of the text matched on a
  283. chapter heading is shorter, so that Outline mode will know that
  284. sections are contained in chapters.  This works as long as no other
  285. command starts with `@chap'.
  286.  
  287.    Outline mode makes a line invisible by changing the newline before it
  288. into an ASCII control-M (code 015).  Most editing commands that work on
  289. lines treat an invisible line as part of the previous line because,
  290. strictly speaking, it *is* part of that line, since there is no longer a
  291. newline in between.  When you save the file in Outline mode, control-M
  292. characters are saved as newlines, so the invisible lines become ordinary
  293. lines in the file.  But saving does not change the visibility status of
  294. a line inside Emacs.
  295.  
  296. 
  297. File: emacs,  Node: Outline Motion,  Next: Outline Visibility,  Prev: Outline Format,  Up: Outline Mode
  298.  
  299. Outline Motion Commands
  300. -----------------------
  301.  
  302.    There are some special motion commands in Outline mode that move
  303. backward and forward to heading lines.
  304.  
  305. `C-c C-n'
  306.      Move point to the next visible heading line
  307.      (`outline-next-visible-heading').
  308.  
  309. `C-c C-p'
  310.      Move point to the previous visible heading line
  311.      (`outline-previous-visible-heading').
  312.  
  313. `C-c C-f'
  314.      Move point to the next visible heading line at the same level as
  315.      the one point is on (`outline-forward-same-level').
  316.  
  317. `C-c C-b'
  318.      Move point to the previous visible heading line at the same level
  319.      (`outline-backward-same-level').
  320.  
  321. `C-c C-u'
  322.      Move point up to a lower-level (more inclusive) visible heading
  323.      line (`outline-up-heading').
  324.  
  325.    `C-c C-n' (`next-visible-heading') moves down to the next heading
  326. line.  `C-c C-p' (`previous-visible-heading') moves similarly backward.
  327. Both accept numeric arguments as repeat counts.  The names emphasize
  328. that invisible headings are skipped, but this is not really a special
  329. feature.  All editing commands that look for lines ignore the invisible
  330. lines automatically.
  331.  
  332.    More powerful motion commands understand the level structure of
  333. headings.  `C-c C-f' (`outline-forward-same-level') and `C-c C-b'
  334. (`outline-backward-same-level') move from one heading line to another
  335. visible heading at the same depth in the outline.  `C-c C-u'
  336. (`outline-up-heading') moves backward to another heading that is less
  337. deeply nested.
  338.  
  339. 
  340. File: emacs,  Node: Outline Visibility,  Prev: Outline Motion,  Up: Outline Mode
  341.  
  342. Outline Visibility Commands
  343. ---------------------------
  344.  
  345.    The other special commands of outline mode are used to make lines
  346. visible or invisible.  Their names all start with `hide' or `show'.
  347. Most of them fall into pairs of opposites.  They are not undoable;
  348. instead, you can undo right past them.  Making lines visible or
  349. invisible is simply not recorded by the undo mechanism.
  350.  
  351. `M-x hide-body'
  352.      Make all body lines in the buffer invisible.
  353.  
  354. `M-x show-all'
  355.      Make all lines in the buffer visible.
  356.  
  357. `C-c C-h'
  358.      Make everything under this heading invisible, not including this
  359.      heading itself
  360.      (`hide-subtree').
  361.  
  362. `C-c C-s'
  363.      Make everything under this heading visible, including body,
  364.      subheadings, and their bodies (`show-subtree').
  365.  
  366. `M-x hide-leaves'
  367.      Make the body of this heading line, and of all its subheadings,
  368.      invisible.
  369.  
  370. `M-x show-branches'
  371.      Make all subheadings of this heading line, at all levels, visible.
  372.  
  373. `C-c C-i'
  374.      Make immediate subheadings (one level down) of this heading line
  375.      visible (`show-children').
  376.  
  377. `M-x hide-entry'
  378.      Make this heading line's body invisible.
  379.  
  380. `M-x show-entry'
  381.      Make this heading line's body visible.
  382.  
  383.    Two commands that are exact opposites are `M-x hide-entry' and `M-x
  384. show-entry'.  They are used with point on a heading line, and apply
  385. only to the body lines of that heading.  The subtopics and their bodies
  386. are not affected.
  387.  
  388.    Two more powerful opposites are `C-c C-h' (`hide-subtree') and `C-c
  389. C-s' (`show-subtree').  Both expect to be used when point is on a
  390. heading line, and both apply to all the lines of that heading's
  391. "subtree": its body, all its subheadings, both direct and indirect, and
  392. all of their bodies.  In other words, the subtree contains everything
  393. following this heading line, up to and not including the next heading of
  394. the same or higher rank.
  395.  
  396.    Intermediate between a visible subtree and an invisible one is having
  397. all the subheadings visible but none of the body.  There are two
  398. commands for doing this, depending on whether you want to hide the
  399. bodies or make the subheadings visible.  They are `M-x hide-leaves' and
  400. `M-x show-branches'.
  401.  
  402.    A little weaker than `show-branches' is `C-c C-i' (`show-children').
  403. It makes just the direct subheadings visible--those one level down.
  404. Deeper subheadings remain invisible, if they were invisible.
  405.  
  406.    Two commands have a blanket effect on the whole file.  `M-x
  407. hide-body' makes all body lines invisible, so that you see just the
  408. outline structure.  `M-x show-all' makes all lines visible.  These
  409. commands can be thought of as a pair of opposites even though `M-x
  410. show-all' applies to more than just body lines.
  411.  
  412.    You can turn off the use of ellipses at the ends of visible lines by
  413. setting `selective-display-ellipses' to `nil'.  Then there is no
  414. visible indication of the presence of invisible lines.
  415.  
  416. 
  417. File: emacs,  Node: TeX Mode,  Next: Nroff Mode,  Prev: Outline Mode,  Up: Text
  418.  
  419. TeX Mode
  420. ========
  421.  
  422.    TeX is a powerful text formatter written by Donald Knuth; it is also
  423. free, like GNU Emacs.  LaTeX is a simplified input format for TeX,
  424. implemented by TeX macros; it comes with TeX.  SliTeX is a special form
  425. of LaTeX.
  426.  
  427.    Emacs has a special TeX mode for editing TeX input files.  It
  428. provides facilities for checking the balance of delimiters and for
  429. invoking TeX on all or part of the file.
  430.  
  431.    TeX mode has three variants, Plain TeX mode, LaTeX mode, and SliTeX
  432. mode (these three distinct major modes differ only slightly).  They are
  433. designed for editing the three different formats.  The command `M-x
  434. tex-mode' looks at the contents of the buffer to determine whether the
  435. contents appear to be either LaTeX input or SliTeX input; it then
  436. selects the appropriate mode.  If it can't tell which is right (e.g.,
  437. the buffer is empty), the variable `tex-default-mode' controls which
  438. mode is used.
  439.  
  440.    When `M-x tex-mode' does not guess right, you can use the commands
  441. `M-x plain-tex-mode', `M-x latex-mode', and `M-x slitex-mode' to select
  442. explicitly the particular variants of TeX mode.
  443.  
  444. * Menu:
  445.  
  446. * Editing: TeX Editing.   Special commands for editing in TeX mode.
  447. * LaTeX: LaTeX Editing.   Additional commands for LaTeX input files.
  448. * Printing: TeX Print.    Commands for printing part of a file with TeX.
  449. * Getting: TeX Distrib.   Getting the latest Unix TeX distribution.
  450.  
  451. 
  452. File: emacs,  Node: TeX Editing,  Next: LaTeX Editing,  Up: TeX Mode
  453.  
  454. TeX Editing Commands
  455. --------------------
  456.  
  457.    Here are the special commands provided in TeX mode for editing the
  458. text of the file.
  459.  
  460. `"'
  461.      Insert, according to context, either ```' or `"' or `'''
  462.      (`tex-insert-quote').
  463.  
  464. `LFD'
  465.      Insert a paragraph break (two newlines) and check the previous
  466.      paragraph for unbalanced braces or dollar signs
  467.      (`tex-terminate-paragraph').
  468.  
  469. `M-x validate-tex-region'
  470.      Check each paragraph in the region for unbalanced braces or dollar
  471.      signs.
  472.  
  473. `C-c {'
  474.      Insert `{}' and position point between them (`tex-insert-braces').
  475.  
  476. `C-c }'
  477.      Move forward past the next unmatched close brace (`up-list').
  478.  
  479.    In TeX, the character `"' is not normally used; we use ```' to start
  480. a quotation and `''' to end one.  To make editing easier under this
  481. formatting convention, TeX mode overrides the normal meaning of the key
  482. `"' with a command that inserts a pair of single-quotes or backquotes
  483. (`tex-insert-quote').  To be precise, this command inserts ```' after
  484. whitespace or an open brace, `"' after a backslash, and `''' after any
  485. other character.
  486.  
  487.    If you need the character `"' itself in unusual contexts, use `C-q'
  488. to insert it.  Also, `"' with a numeric argument always inserts that
  489. number of `"' characters.
  490.  
  491.    In TeX mode, `$' has a special syntax code which attempts to
  492. understand the way TeX math mode delimiters match.  When you insert a
  493. `$' that is meant to exit math mode, the position of the matching `$'
  494. that entered math mode is displayed for a second.  This is the same
  495. feature that displays the open brace that matches a close brace that is
  496. inserted.  However, there is no way to tell whether a `$' enters math
  497. mode or leaves it; so when you insert a `$' that enters math mode, the
  498. previous `$' position is shown as if it were a match, even though they
  499. are actually unrelated.
  500.  
  501.    TeX uses braces as delimiters that must match.  Some users prefer to
  502. keep braces balanced at all times, rather than inserting them singly.
  503. Use `C-c {' (`tex-insert-braces') to insert a pair of braces.  It
  504. leaves point between the two braces so you can insert the text that
  505. belongs inside.  Afterward, use the command `C-c }' (`up-list') to move
  506. forward past the close brace.
  507.  
  508.    There are two commands for checking the matching of braces.  LFD
  509. (`tex-terminate-paragraph') checks the paragraph before point, and
  510. inserts two newlines to start a new paragraph.  It prints a message in
  511. the echo area if any mismatch is found.  `M-x validate-tex-region'
  512. checks a region, paragraph by paragraph.  When it finds a paragraph that
  513. contains a mismatch, it displays point at the beginning of the paragraph
  514. for a few seconds and pushes a mark at that spot.  Scanning continues
  515. until the whole buffer has been checked or until you type another key.
  516. The positions of the last several paragraphs with mismatches can be
  517. found in the mark ring (*note Mark Ring::.).
  518.  
  519.    Note that Emacs commands count square brackets and parentheses in
  520. TeX mode, not just braces.  This is not strictly correct for the
  521. purpose of checking TeX syntax.  However, parentheses and square
  522. brackets are likely to be used in text as matching delimiters and it is
  523. useful for the various motion commands and automatic match display to
  524. work with them.
  525.  
  526. 
  527. File: emacs,  Node: LaTeX Editing,  Next: TeX Print,  Prev: TeX Editing,  Up: TeX Mode
  528.  
  529. LaTeX Editing Commands
  530. ----------------------
  531.  
  532.    LaTeX mode provides a few extra features not applicable to plain TeX.
  533.  
  534. `C-c C-o'
  535.      Insert `\begin' and `\end' for LaTeX block and position point on a
  536.      line between them. (`tex-latex-block').
  537.  
  538. `C-c C-e'
  539.      Close the last unended block for LaTeX (`tex-close-latex-block').
  540.  
  541.    In LaTeX input, `\begin' and `\end' commands are used to group
  542. blocks of text.  To insert a `\begin' and a matching `\end' (on a new
  543. line following the `\begin'), use `C-c C-o' (`tex-latex-block').  A
  544. blank line is inserted between the two, and point is left there.
  545.  
  546.    Emacs knows all of the standard LaTeX block names and will
  547. permissively complete a partially entered block name (*note
  548. Completion::.).  You can add your own list of block names to those
  549. known by Emacs with the variable `latex-block-names'.  For example, to
  550. add `theorem', `corollary', and `proof', include the line
  551.  
  552.      (setq latex-block-names '("theorem" "corollary" "proof"))
  553.  
  554. to your `.emacs' file.
  555.  
  556.    In LaTeX input, `\begin' and `\end' commands must balance.  You can
  557. use `C-c C-e' (`tex-close-latex-block') to insert automatically a
  558. matching `\end' to match the last unmatched `\begin'.  The `\end' will
  559. be indented to match the corresponding `\begin'.  The `\end' will be
  560. followed by a newline if point is at the beginning of a line.
  561.  
  562. 
  563. File: emacs,  Node: TeX Print,  Next: TeX Distrib,  Prev: LaTeX Editing,  Up: TeX Mode
  564.  
  565. TeX Printing Commands
  566. ---------------------
  567.  
  568.    You can invoke TeX as an inferior of Emacs on either the entire
  569. contents of the buffer or just a region at a time.  Running TeX in this
  570. way on just one chapter is a good way to see what your changes look
  571. like without taking the time to format the entire file.
  572.  
  573. `C-c C-r'
  574.      Invoke TeX on the current region, together with the buffer's header
  575.      (`tex-region').
  576.  
  577. `C-c C-b'
  578.      Invoke TeX on the entire current buffer (`tex-buffer').
  579.  
  580. `C-c TAB'
  581.      Invoke BibTeX on the current file (`tex-bibtex-file').
  582.  
  583. `C-c C-f'
  584.      Invoke TeX on the current file (`tex-file').
  585.  
  586. `C-c C-l'
  587.      Recenter the window showing output from the inferior TeX so that
  588.      the last line can be seen (`tex-recenter-output-buffer').
  589.  
  590. `C-c C-k'
  591.      Kill the TeX subprocess (`tex-kill-job').
  592.  
  593. `C-c C-p'
  594.      Print the output from the last `C-c C-r', `C-c C-b', or `C-c C-f'
  595.      command (`tex-print').
  596.  
  597. `C-c C-v'
  598.      Preview the output from the last `C-c C-r', `C-c C-b', or `C-c
  599.      C-f' command (`tex-view').
  600.  
  601. `C-c C-q'
  602.      Show the printer queue (`tex-show-print-queue').
  603.  
  604.    You can pass the current buffer through an inferior TeX by means of
  605. `C-c C-b' (`tex-buffer').  The formatted output appears in a temporary;
  606. to print it, type `C-c C-p' (`tex-print').  Afterward use `C-c C-q'
  607. (`tex-show-print-queue') to view the progress of your output towards
  608. being printed. If your terminal has the ability to display TeX output
  609. files, you can preview the output on the terminal with `C-c C-v'
  610. (`tex-view').
  611.  
  612.    You can specify the directory to use for running TeX by setting the
  613. variable `tex-directory'.  `"."' is the default value.  If your
  614. environment variable `TEXINPUTS' contains relative directory names, or
  615. if your files contains `\input' commands with relative file names, then
  616. `tex-directory' *must* be `"."' or you will get the wrong results.
  617. Otherwise, it is safe to specify some other directory, such as `/tmp'.
  618.  
  619.    If you want to specify which shell commands are used in the inferior
  620. TeX, you can do so by setting the values of the variables
  621. `tex-run-command', `latex-run-command', `slitex-run-command',
  622. `tex-dvi-print-command', `tex-dvi-view-command', and
  623. `tex-show-queue-command'.  You *must* set the value of
  624. `tex-dvi-view-command' for your particular terminal; this variable has
  625. no default value.  The other variables have default values that may (or
  626. may not) be appropriate for your system.
  627.  
  628.    Normally, the file name given to these commands comes at the end of
  629. the command string; for example, `latex FILENAME'.  In some cases,
  630. however, the file name needs to be embedded in the command; an example
  631. is when you need to provide the file name as an argument to one command
  632. whose output is piped to another.  You can specify where to put the
  633. file name with `*' in the command string.  For example,
  634.  
  635.      (setq tex-dvi-print-command "dvips -f * | lpr")
  636.  
  637.    The terminal output from TeX, including any error messages, appears
  638. in a buffer called `*tex-shell*'.  If TeX gets an error, you can switch
  639. to this buffer and feed it input (this works as in Shell mode; *note
  640. Interactive Shell::.).  Without switching to this buffer you can scroll
  641. it so that its last line is visible by typing `C-c C-l'.
  642.  
  643.    Type `C-c C-k' (`tex-kill-job') to kill the TeX process if you see
  644. that its output is no longer useful.  Using `C-c C-b' or `C-c C-r' also
  645. kills any TeX process still running.
  646.  
  647.    You can also pass an arbitrary region through an inferior TeX by
  648. typing `C-c C-r' (`tex-region').  This is tricky, however, because most
  649. files of TeX input contain commands at the beginning to set parameters
  650. and define macros, without which no later part of the file will format
  651. correctly.  To solve this problem, `C-c C-r' allows you to designate a
  652. part of the file as containing essential commands; it is included before
  653. the specified region as part of the input to TeX.  The designated part
  654. of the file is called the "header".
  655.  
  656.    To indicate the bounds of the header in Plain TeX mode, you insert
  657. two special strings in the file.  Insert `%**start of header' before the
  658. header, and `%**end of header' after it.  Each string must appear
  659. entirely on one line, but there may be other text on the line before or
  660. after.  The lines containing the two strings are included in the header.
  661. If `%**start of header' does not appear within the first 100 lines of
  662. the buffer, `C-c C-r' assumes that there is no header.
  663.  
  664.    In LaTeX mode, the header begins with `\documentstyle' and ends with
  665. `\begin{document}'.  These are commands that LaTeX requires you to use
  666. in any case, so nothing special needs to be done to identify the header.
  667.  
  668.    The commands (`tex-buffer') and (`tex-region') do all of their work
  669. in a temporary directory, and do not have available any of the auxiliary
  670. files needed by TeX for cross-references; these commands are generally
  671. not suitable for running the final copy in which all of the
  672. cross-references need to be correct.  When you want the auxiliary
  673. files, use `C-c C-f' (`tex-file') which runs TeX on the current
  674. buffer's file, in that file's directory.  Before TeX runs, you will be
  675. asked about saving any modified buffers.  Generally, you need to use
  676. (`tex-file') twice to get cross-references correct.
  677.  
  678.    For LaTeX files, you can use BibTeX to process the auxiliary file
  679. for the current buffer's file.  BibTeX looks up bibliographic citations
  680. in a data base and prepares the cited references for the bibliography
  681. section.  The command `C-c TAB' (`tex-bibtex-file') runs the shell
  682. command (`tex-bibtex-command') to produce a `.bbl' file for the current
  683. buffer's file.  Generally, you need to do `C-c C-f' (`tex-file') once
  684. to generate the `.aux' file, then do `C-c TAB' (`tex-bibtex-file'), and
  685. then repeat `C-c C-f' (`tex-file') twice more to get the
  686. cross-references correct.
  687.  
  688.    Entering any kind of TeX mode runs the hooks `text-mode-hook' and
  689. `tex-mode-hook'.  Then it runs either `plain-tex-mode-hook' or
  690. `latex-mode-hook', whichever is appropriate.  For SliTeX files, it
  691. calls `slitex-mode-hook'.  Starting the TeX shell runs the hook
  692. `tex-shell-hook'.  *Note Hooks::.
  693.  
  694. 
  695. File: emacs,  Node: TeX Distrib,  Prev: TeX Print,  Up: TeX Mode
  696.  
  697. Unix TeX Distribution
  698. ---------------------
  699.  
  700.    TeX for Unix systems can be obtained from the University of
  701. Washington for a distribution fee.
  702.  
  703.    To order a full distribution, send $200.00 for a 1/2-inch 9-track
  704. 1600 bpi (tar or cpio) tape reel, or $210.00 for a 1/4-inch 4-track
  705. QIC-24 (tar or cpio) cartridge, payable to the University of Washington
  706. to:
  707.  
  708.      Northwest Computing Support Center
  709.      DR-10, Thomson Hall 35
  710.      University of Washington
  711.      Seattle, Washington 98195
  712.  
  713. Purchase orders are acceptable, but there is an extra charge of $10.00,
  714. to pay for processing charges.
  715.  
  716. For overseas orders please add $20.00 to the base cost for shipment via
  717. air parcel post, or $30.00 for shipment via courier.
  718.  
  719.    The normal distribution is a tar tape, blocked 20, 1600 bpi, on an
  720. industry standard 2400 foot half-inch reel.  The physical format for
  721. the 1/4 inch streamer cartridges uses QIC-11, 8000 bpi, 4-track
  722. serpentine recording for the SUN.  Also, System V tapes can be written
  723. in cpio format, blocked 5120 bytes, ASCII headers.
  724.  
  725. 
  726. File: emacs,  Node: Nroff Mode,  Prev: TeX Mode,  Up: Text
  727.  
  728. Nroff Mode
  729. ==========
  730.  
  731.    Nroff mode is a mode like Text mode but modified to handle nroff
  732. commands present in the text.  Invoke `M-x nroff-mode' to enter this
  733. mode.  It differs from Text mode in only a few ways.  All nroff command
  734. lines are considered paragraph separators, so that filling will never
  735. garble the nroff commands.  Pages are separated by `.bp' commands.
  736. Comments start with backslash-doublequote.  Also, three special
  737. commands are provided that are not in Text mode:
  738.  
  739. `M-n'
  740.      Move to the beginning of the next line that isn't an nroff command
  741.      (`forward-text-line').  An argument is a repeat count.
  742.  
  743. `M-p'
  744.      Like `M-n' but move up (`backward-text-line').
  745.  
  746. `M-?'
  747.      Prints in the echo area the number of text lines (lines that are
  748.      not nroff commands) in the region (`count-text-lines').
  749.  
  750.    The other feature of Nroff mode is that you can turn on Electric
  751. Nroff mode.  This is a minor mode that you can turn on or off with `M-x
  752. electric-nroff-mode' (*note Minor Modes::.).  When the mode is on, each
  753. time you use RET to end a line that contains an nroff command that
  754. opens a kind of grouping, the matching nroff command to close that
  755. grouping is automatically inserted on the following line.  For example,
  756. if you are at the beginning of a line and type `. ( b RET', this
  757. inserts the matching command `.)b' on a new line following point.
  758.  
  759.    Entering Nroff mode runs the hook `text-mode-hook', followed by the
  760. hook `nroff-mode-hook' (*note Hooks::.).
  761.  
  762. 
  763. File: emacs,  Node: Programs,  Next: Building,  Prev: Text,  Up: Top
  764.  
  765. Editing Programs
  766. ****************
  767.  
  768.    Emacs has many commands designed to understand the syntax of
  769. programming languages such as Lisp and C.  These commands can
  770.  
  771.    * Move over or kill balanced expressions or "sexps" (*note Lists::.).
  772.  
  773.    * Move over or mark top-level expressions--"defuns", in Lisp;
  774.      functions, in C (*note Defuns::.).
  775.  
  776.    * Show how parentheses balance (*note Matching::.).
  777.  
  778.    * Insert, kill or align comments (*note Comments::.).
  779.  
  780.    * Follow the usual indentation conventions of the language (*note
  781.      Program Indent::.).
  782.  
  783.    The commands for words, sentences and paragraphs are very useful in
  784. editing code even though their canonical application is for editing
  785. human language text.  Most symbols contain words (*note Words::.);
  786. sentences can be found in strings and comments (*note Sentences::.).
  787. Paragraphs per se don't exist in code, but the paragraph commands are
  788. useful anyway, because programming language major modes define
  789. paragraphs to begin and end at blank lines (*note Paragraphs::.).
  790. Judicious use of blank lines to make the program clearer will also
  791. provide interesting chunks of text for the paragraph commands to work
  792. on.
  793.  
  794.    The selective display feature is useful for looking at the overall
  795. structure of a function (*note Selective Display::.).  This feature
  796. causes only the lines that are indented less than a specified amount to
  797. appear on the screen.
  798.  
  799. * Menu:
  800.  
  801. * Program Modes::     Major modes for editing programs.
  802. * Lists::             Expressions with balanced parentheses.
  803. * List Commands::     The commands for working with list and sexps.
  804. * Defuns::            Each program is made up of separate functions.
  805.                         There are editing commands to operate on them.
  806. * Program Indent::    Adjusting indentation to show the nesting.
  807. * Matching::          Insertion of a close-delimiter flashes matching open.
  808. * Comments::          Inserting, killing, and aligning comments.
  809. * Balanced Editing::  Inserting two matching parentheses at once, etc.
  810. * Symbol Completion:: Completion on symbol names of your program or language.
  811. * Documentation::     Getting documentation of functions you plan to call.
  812. * Change Log::        Maintaining a change history for your program.
  813. * Tags::              Go direct to any function in your program in one
  814.                         command.  Tags remembers which file it is in.
  815. * Emerge::          A convenient way of merging two versions of a program.
  816. * C Mode::          Special commands of C mode (and C++ mode).
  817. * Fortran::          Fortran mode and its special features.
  818. * Asm Mode::          Asm mode and its special features.
  819.  
  820. 
  821. File: emacs,  Node: Program Modes,  Next: Lists,  Up: Programs
  822.  
  823. Major Modes for Programming Languages
  824. =====================================
  825.  
  826.    Emacs also has major modes for the programming languages Lisp, Scheme
  827. (a variant of Lisp), Awk, C, C++, Perl, Icon, Fortran and Muddle
  828. (another variant of Lisp).  There is also a major mode for makefiles,
  829. called Makefile mode.
  830.  
  831.    Ideally, a major mode should be implemented for each programming
  832. language that you might want to edit with Emacs; but often the mode for
  833. one language can serve for other syntactically similar languages.  The
  834. language modes that exist are those that someone decided to take the
  835. trouble to write.
  836.  
  837.    There are several forms of Lisp mode, which differ in the way they
  838. interface to Lisp execution.  *Note Executing Lisp::.
  839.  
  840.    Each of the programming language modes defines the TAB key to run an
  841. indentation function that knows the indentation conventions of that
  842. language and updates the current line's indentation accordingly.  For
  843. example, in C mode TAB is bound to `c-indent-line'.  LFD is normally
  844. defined to do RET followed by TAB; thus, it too indents in a
  845. mode-specific fashion.
  846.  
  847.    In most programming languages, indentation is likely to vary from
  848. line to line.  So the major modes for those languages rebind DEL to
  849. treat a tab as if it were the equivalent number of spaces (using the
  850. command `backward-delete-char-untabify').  This makes it possible to
  851. rub out indentation one column at a time without worrying whether it is
  852. made up of spaces or tabs.  Use `C-b C-d' to delete a tab character
  853. before point, in these modes.
  854.  
  855.    Programming language modes define paragraphs to be separated only by
  856. blank lines, so that the paragraph commands remain useful.  Auto Fill
  857. mode, if enabled in a programming language major mode, indents the new
  858. lines which it creates.
  859.  
  860.    Turning on a major mode runs a normal hook called the "mode hook",
  861. which is the value of a Lisp variable.  For example, turning on C mode
  862. runs the hook `c-mode-hook'.  Mode hook variables for other programming
  863. language modes include `lisp-mode-hook', `emacs-lisp-mode-hook',
  864. `lisp-interaction-mode-hook', `scheme-mode-hook' and
  865. `muddle-mode-hook'.  *Note Hooks::.
  866.  
  867. 
  868. File: emacs,  Node: Lists,  Next: List Commands,  Prev: Program Modes,  Up: Programs
  869.  
  870. Lists and Sexps
  871. ===============
  872.  
  873.    By convention, Emacs keys for dealing with balanced expressions are
  874. usually Control-Meta characters.  They tend to be analogous in function
  875. to their Control and Meta equivalents.  These commands are usually
  876. thought of as pertaining to expressions in programming languages, but
  877. can be useful with any language in which some sort of parentheses exist
  878. (including human languages).
  879.  
  880.    These commands fall into two classes.  Some deal only with "lists"
  881. (parenthetical groupings).  They see nothing except parentheses,
  882. brackets, braces (whichever ones must balance in the language you are
  883. working with), and escape characters that might be used to quote those.
  884.  
  885.    The other commands deal with expressions or "sexps".  The word `sexp'
  886. is derived from "s-expression", the ancient term for an expression in
  887. Lisp.  But in Emacs, the notion of `sexp' is not limited to Lisp.  It
  888. refers to an expression in whatever language your program is written in.
  889. Each programming language has its own major mode, which customizes the
  890. syntax tables so that expressions in that language count as sexps.
  891.  
  892.    Sexps typically include symbols, numbers, and string constants, as
  893. well as anything contained in parentheses, brackets or braces.
  894.  
  895.    In languages that use prefix and infix operators, such as C, it is
  896. not possible for all expressions to be sexps.  For example, C mode does
  897. not recognize `foo + bar' as a sexp, even though it *is* a C expression;
  898. it recognizes `foo' as one sexp and `bar' as another, with the `+' as
  899. punctuation between them.  This is a fundamental ambiguity: both `foo +
  900. bar' and `foo' are legitimate choices for the sexp to move over if
  901. point is at the `f'.  Note that `(foo + bar)' is a single sexp in C
  902. mode.
  903.  
  904.    Some languages have obscure forms of syntax for expressions that
  905. nobody has bothered to make Emacs understand properly.
  906.  
  907. 
  908. File: emacs,  Node: List Commands,  Next: Defuns,  Prev: Lists,  Up: Programs
  909.  
  910. List And Sexp Commands
  911. ======================
  912.  
  913. `C-M-f'
  914.      Move forward over a sexp (`forward-sexp').
  915.  
  916. `C-M-b'
  917.      Move backward over a sexp (`backward-sexp').
  918.  
  919. `C-M-k'
  920.      Kill sexp forward (`kill-sexp').
  921.  
  922. `C-M-u'
  923.      Move up and backward in list structure (`backward-up-list').
  924.  
  925. `C-M-d'
  926.      Move down and forward in list structure (`down-list').
  927.  
  928. `C-M-n'
  929.      Move forward over a list (`forward-list').
  930.  
  931. `C-M-p'
  932.      Move backward over a list (`backward-list').
  933.  
  934. `C-M-t'
  935.      Transpose expressions (`transpose-sexps').
  936.  
  937. `C-M-@'
  938.      Put mark after following expression (`mark-sexp').
  939.  
  940.    To move forward over a sexp, use `C-M-f' (`forward-sexp').  If the
  941. first significant character after point is an opening delimiter (`(' in
  942. Lisp; `(', `[' or `{' in C), `C-M-f' moves past the matching closing
  943. delimiter.  If the character begins a symbol, string, or number,
  944. `C-M-f' moves over that.
  945.  
  946.    The command `C-M-b' (`backward-sexp') moves backward over a sexp.
  947. The detailed rules are like those above for `C-M-f', but with
  948. directions reversed.  If there are any prefix characters (single-quote,
  949. backquote and comma, in Lisp) preceding the sexp, `C-M-b' moves back
  950. over them as well.  The sexp commands move across comments as if they
  951. were whitespace in most modes.
  952.  
  953.    `C-M-f' or `C-M-b' with an argument repeats that operation the
  954. specified number of times; with a negative argument, it moves in the
  955. opposite direction.
  956.  
  957.    Killing a sexp at a time can be done with `C-M-k' (`kill-sexp').
  958. `C-M-k' kills the characters that `C-M-f' would move over.
  959.  
  960.    The "list commands" move over lists like the sexp commands but skip
  961. blithely over any number of other kinds of sexps (symbols, strings,
  962. etc).  They are `C-M-n' (`forward-list') and `C-M-p' (`backward-list').
  963. The main reason they are useful is that they usually ignore comments
  964. (since the comments usually do not contain any lists).
  965.  
  966.    `C-M-n' and `C-M-p' stay at the same level in parentheses, when
  967. that's possible.  To move *up* one (or N) levels, use `C-M-u'
  968. (`backward-up-list').  `C-M-u' moves backward up past one unmatched
  969. opening delimiter.  A positive argument serves as a repeat count; a
  970. negative argument reverses direction of motion and also requests
  971. repetition, so it moves forward and up one or more levels.
  972.  
  973.    To move *down* in list structure, use `C-M-d' (`down-list').  In
  974. Lisp mode, where `(' is the only opening delimiter, this is nearly the
  975. same as searching for a `('.  An argument specifies the number of levels
  976. of parentheses to go down.
  977.  
  978.    A somewhat random-sounding command which is nevertheless handy is
  979. `C-M-t' (`transpose-sexps'), which drags the previous sexp across the
  980. next one.  An argument serves as a repeat count, and a negative
  981. argument drags backwards (thus canceling out the effect of `C-M-t' with
  982. a positive argument).  An argument of zero, rather than doing nothing,
  983. transposes the sexps ending after point and the mark.
  984.  
  985.    To make the region be the next sexp in the buffer, use `C-M-@'
  986. (`mark-sexp') which sets mark at the same place that `C-M-f' would move
  987. to.  `C-M-@' takes arguments like `C-M-f'.  In particular, a negative
  988. argument is useful for putting the mark at the beginning of the
  989. previous sexp.
  990.  
  991.    The list and sexp commands' understanding of syntax is completely
  992. controlled by the syntax table.  Any character can, for example, be
  993. declared to be an opening delimiter and act like an open parenthesis.
  994. *Note Syntax::.
  995.  
  996. 
  997. File: emacs,  Node: Defuns,  Next: Program Indent,  Prev: List Commands,  Up: Programs
  998.  
  999. Defuns
  1000. ======
  1001.  
  1002.    In Emacs, a parenthetical grouping at the top level in the buffer is
  1003. called a "defun".  The name derives from the fact that most top-level
  1004. lists in a Lisp file are instances of the special form `defun', but any
  1005. top-level parenthetical grouping counts as a defun in Emacs parlance
  1006. regardless of what its contents are, and regardless of the programming
  1007. language in use.  For example, in C, the body of a function definition
  1008. is a defun.
  1009.  
  1010. `C-M-a'
  1011.      Move to beginning of current or preceding defun
  1012.      (`beginning-of-defun').
  1013.  
  1014. `C-M-e'
  1015.      Move to end of current or following defun (`end-of-defun').
  1016.  
  1017. `C-M-h'
  1018.      Put region around whole current or following defun (`mark-defun').
  1019.  
  1020.    The commands to move to the beginning and end of the current defun
  1021. are `C-M-a' (`beginning-of-defun') and `C-M-e' (`end-of-defun').
  1022.  
  1023.    If you wish to operate on the current defun, use `C-M-h'
  1024. (`mark-defun') which puts point at the beginning and mark at the end of
  1025. the current or next defun.  For example, this is the easiest way to get
  1026. ready to move the defun to a different place in the text.  In C mode,
  1027. `C-M-h' runs the function `mark-c-function', which is almost the same
  1028. as `mark-defun'; the difference is that it backs up over the argument
  1029. declarations, function name and returned data type so that the entire C
  1030. function is inside the region.  *Note Marking Objects::.
  1031.  
  1032.    Emacs assumes that any open-parenthesis found in the leftmost column
  1033. is the start of a defun.  Therefore, *never put an open-parenthesis at
  1034. the left margin in a Lisp file unless it is the start of a top level
  1035. list.  Never put an open-brace or other opening delimiter at the
  1036. beginning of a line of C code unless it starts the body of a function.*
  1037. The most likely problem case is when you want an opening delimiter at
  1038. the start of a line inside a string.  To avoid trouble, put an escape
  1039. character (`\', in C and Emacs Lisp, `/' in some other Lisp dialects)
  1040. before the opening delimiter.  It will not affect the contents of the
  1041. string.
  1042.  
  1043.    In the remotest past, the original Emacs found defuns by moving
  1044. upward a level of parentheses until there were no more levels to go up.
  1045. This always required scanning all the way back to the beginning of the
  1046. buffer, even for a small function.  To speed up the operation, Emacs
  1047. was changed to assume that any `(' (or other character assigned the
  1048. syntactic class of opening-delimiter) at the left margin is the start
  1049. of a defun.  This heuristic is nearly always right and avoids the
  1050. costly scan; however, it mandates the convention described above.
  1051.  
  1052. 
  1053. File: emacs,  Node: Program Indent,  Next: Matching,  Prev: Defuns,  Up: Programs
  1054.  
  1055. Indentation for Programs
  1056. ========================
  1057.  
  1058.    The best way to keep a program properly indented is to use Emacs to
  1059. re-indent it as you change it.  Emacs has commands to indent properly
  1060. either a single line, a specified number of lines, or all of the lines
  1061. inside a single parenthetical grouping.
  1062.  
  1063. * Menu:
  1064.  
  1065. * Basic Indent::    Indenting a single line.
  1066. * Multi-line Indent::   Commands to reindent many lines at once.
  1067. * Lisp Indent::        Specifying how each Lisp function should be indented.
  1068. * C Indent::        Choosing an indentation style for C code.
  1069.  
  1070. 
  1071. File: emacs,  Node: Basic Indent,  Next: Multi-line Indent,  Up: Program Indent
  1072.  
  1073. Basic Program Indentation Commands
  1074. ----------------------------------
  1075.  
  1076. `TAB'
  1077.      Adjust indentation of current line.
  1078.  
  1079. `LFD'
  1080.      Equivalent to RET followed by TAB (`newline-and-indent').
  1081.  
  1082.    The basic indentation command is TAB, which gives the current line
  1083. the correct indentation as determined from the previous lines.  The
  1084. function that TAB runs depends on the major mode; it is
  1085. `lisp-indent-line' in Lisp mode, `c-indent-line' in C mode, etc.  These
  1086. functions understand different syntaxes for different languages, but
  1087. they all do about the same thing.  TAB in any programming language
  1088. major mode inserts or deletes whitespace at the beginning of the
  1089. current line, independent of where point is in the line.  If point is
  1090. inside the whitespace at the beginning of the line, TAB leaves it at
  1091. the end of that whitespace; otherwise, TAB leaves point fixed with
  1092. respect to the characters around it.
  1093.  
  1094.    Use `C-q TAB' to insert a tab at point.
  1095.  
  1096.    When entering a large amount of new code, use LFD
  1097. (`newline-and-indent'), which is equivalent to a RET followed by a TAB.
  1098. LFD creates a blank line, and then gives it the appropriate
  1099. indentation.
  1100.  
  1101.    TAB indents the second and following lines of the body of a
  1102. parenthetical grouping each under the preceding one; therefore, if you
  1103. alter one line's indentation to be nonstandard, the lines below will
  1104. tend to follow it.  This is the right behavior in cases where the
  1105. standard result of TAB is unaesthetic.
  1106.  
  1107.    Remember that an open-parenthesis, open-brace or other opening
  1108. delimiter at the left margin is assumed by Emacs (including the
  1109. indentation routines) to be the start of a function.  Therefore, you
  1110. must never have an opening delimiter in column zero that is not the
  1111. beginning of a function, not even inside a string.  This restriction is
  1112. vital for making the indentation commands fast; you must simply accept
  1113. it.  *Note Defuns::, for more information on this.
  1114.  
  1115. 
  1116. File: emacs,  Node: Multi-line Indent,  Next: Lisp Indent,  Prev: Basic Indent,  Up: Program Indent
  1117.  
  1118. Indenting Several Lines
  1119. -----------------------
  1120.  
  1121.    When you wish to re-indent several lines of code which have been
  1122. altered or moved to a different level in the list structure, you have
  1123. several commands available.
  1124.  
  1125. `C-M-q'
  1126.      Re-indent all the lines within one list (`indent-sexp').
  1127.  
  1128. `C-u TAB'
  1129.      Shift an entire list rigidly sideways so that its first line is
  1130.      properly indented.
  1131.  
  1132. `C-M-\'
  1133.      Re-indent all lines in the region (`indent-region').
  1134.  
  1135.    You can re-indent the contents of a single list by positioning point
  1136. before the beginning of it and typing `C-M-q' (`indent-sexp' in Lisp
  1137. mode, `indent-c-exp' in C mode; also bound to other suitable commands
  1138. in other modes).  The indentation of the line the sexp starts on is not
  1139. changed; therefore, only the relative indentation within the list, and
  1140. not its position, is changed.  To correct the position as well, type a
  1141. TAB before the `C-M-q'.
  1142.  
  1143.    If the relative indentation within a list is correct but the
  1144. indentation of its beginning is not, go to the line the list begins on
  1145. and type `C-u TAB'.  When TAB is given a numeric argument, it moves all
  1146. the lines in the grouping starting on the current line sideways the
  1147. same amount that the current line moves.  It is clever, though, and
  1148. does not move lines that start inside strings, or C preprocessor lines
  1149. when in C mode.
  1150.  
  1151.    Another way to specify the range to be re-indented is with point and
  1152. mark.  The command `C-M-\' (`indent-region') applies TAB to every line
  1153. whose first character is between point and mark.
  1154.  
  1155.